/**
 * Created by Administrator on 2016/12/14.
 */
+function($){
    $.extend({
        geek:{
            //列表
            index:function(){

            },
            //新增、编辑
            edit:function(){
                $(document).on('click','.the-icons li', function(){
                    $('.the-icons').find('.btn').removeClass('btn');
                    $('.the-icons').find('.selected-icon').removeClass('selected-icon');
                    $('.the-icons').find('.btn-danger').removeClass('btn-danger');
                    $(this).addClass('btn');
                    $(this).addClass('btn-danger');
                    $(this).addClass('selected-icon');
                });
                $('#icon').click(function(){
                    $.get(ThinkPHP.U('Admin/Public/icon'), function(resp){
                        layer.open({
                            area:['800px','600px'],
                            title:'选择图标',
                            btn:['确认'],
                            yes:function(index){
                                var className = $('.selected-icon').find('i').attr('class');
                                $('#icon').attr('class', className);
                                $('input[name="icon"]').val(className);
                                layer.close(index);
                            },
                            content:resp
                        });
                    });
                });
            },
            //配置权限
            setting:function(){
                //添加权限
                $('.add-permission').click(function(){
                    var tr = $('.permission tfoot .hide').clone(true);
                    tr.removeClass('hide');
                    $('.permission tbody').append(tr);
                });
                //删除权限
                $('.icon-trash').click(function(){
                    $(this).parent().parent().remove();
                });
            }
        }
    });
}(jQuery);